package com.jingxuan.common.result;

/**
 * 统一返回状态码枚举
 */
public enum ResultCode {
    
    SUCCESS(0, "成功"),
    
    // 4xxx 客户端错误
    PARAM_ERROR(4001, "请求参数缺失或格式错误"),
    USER_DISABLED(4003, "用户账号已被禁用"),
    LOGIN_FAILED(4010, "登录失败，用户名或密码不正确"),
    UNAUTHORIZED(4010, "未提供有效Token（未登录或登录失效）"),
    FORBIDDEN(4030, "无权限访问"),
    ACCOUNT_LOCKED(4230, "帐号被锁定"),
    NOT_FOUND(4040, "资源不存在"),
    USER_NOT_FOUND(4040, "用户不存在"),
    PRODUCT_NOT_FOUND(4040, "商品不存在"),
    PHONE_EXISTS(4091, "手机号已存在"),
    
    // 5xxx 服务器错误
    INTERNAL_ERROR(5000, "服务器内部错误"),
    DATABASE_ERROR(5001, "数据库操作失败");
    
    
    private final int code;
    private final String message;
    
    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getMessage() {
        return message;
    }
}

